﻿$(document).ready(function () {
    $("#datepicker").datepicker({
        dateFormat: 'dd/mm/yy'
    });
    $(".datepicker").datepicker({
        dateFormat: 'dd/mm/yy'
    });

    $("#datetimepicker").datetimepicker({
        dateFormat: 'dd/mm/yy'
    });

    $("#healthlog").hide();

    $("#btnClose").click(function () {
        self.close();
    });
});

function getTimeline(cID, week) {
    $("#healthlog").hide();
    $.post("/Child/GetTimeline/?childID=" + cID + "&week=" + week, "", function (data) {
        if (data != 0) {
            $("#healthData").empty();
            $("#healthlog").show();
            $("#healthTemplate").tmpl(data).appendTo("#healthData");
        }
    });
}

function deleteKeyword(aID, kID) {
    $.post("/Article/DeleteKeyword/?articleID=" + aID + "&keywordID=" + kID, "", function () {
    });
}

function addKeyword(aID) {
    var kID = $("#newKeyword").val();
    $.post("/Article/AddKeyword/?articleID=" + aID + "&keywordID=" + kID, "", function () {
        location.reload();
    });
}

function approveOrDeny(aID, approved) {
    $.post("/Article/ApproveOrDeny/?id=" + aID + "&approved=" + approved, "", function () {
        location.reload();
    });
}

function banned(uID) {
    $.post("/Home/Banned/?id=" + uID, "", function () {
        location.reload();
    });
}

function approve(uID) {
    $.post("/Home/Approved/?id=" + uID, "", function () {
        location.reload();
    });
}

function makeadmin(uID) {
    $.post("/Home/MakeAdmin/?id=" + uID, "", function () {
        location.reload();
    });
}